import random
import json

# 北京的经纬度范围
min_longitude = 116.1
max_longitude = 116.6
min_latitude = 39.7
max_latitude = 40.1

# 生成100条数据
grid_data = []
for i in range(100):
    grid_id = f"test_grid_id_{i + 1:02d}"
    grid_longitude = round(random.uniform(min_longitude, max_longitude), 6)
    grid_latitude = round(random.uniform(min_latitude, max_latitude), 6)

    grid_data.append({
        "statisTime": "20250801",
        "provId": "北京",
        "gridId": grid_id,
        "gridLongitude": str(grid_longitude),
        "gridLatitude": str(grid_latitude),
        "diffNetUserCount": "100",
        "gsmCustCount": "100",
        "waistCustCount": "100",
        "premiumCustCount": "100",
        "potentialCustCount": "100",
        "shairUserCnt": "100",
        "internationalUserCnt": "100",
        "familyCircleCnt": "100",
        "commuteCircleCnt": "100",
        "socialCircleCnt": "100",
        "campusCircleCnt": "100"
    })

# 将数据写入JSON文件
with open("grid_data.json", "w", encoding="utf-8") as f:
    json.dump(grid_data, f, ensure_ascii=False, indent=4)

print("数据已生成并保存到 grid_data.json 文件中。")
